package tianwang.biz.stat;

import java.util.ArrayList;

import tianwang.model.AticleModel;
import tianwang.model.CAStyle;
import tianwang.services.collect.CollectResult;
import tianwang.services.collect.Collecter;
/**
 * 句长大于55个单词的句子数量
 * 
 * @author tian
 *
 */
public class SentenceLongNumberCollecter  implements Collecter<CollectResult> {
	private final String name = CAStyle.LONG_SENTENCE_NUM;
	/**
	 * 大于55个单词的句子
	 */
	private final int whatIsLong = 55;
	@Override
	public CollectResult collect(Object material) throws Exception {
		AticleModel model = (AticleModel) material;
		ArrayList<ArrayList<String>> sentences= model.getPunctuatorWords();
		
		int count = 0;
		for(ArrayList<String> aSentence : sentences){
			if(aSentence.size() > this.whatIsLong){
				count ++;
			}
		}
		
		final int re = count;
		return new CollectResult(){
			public Object pump(){
				return (int)re;
			}

			@Override
			public String getName() {
				return name;
			}
		};
	}
	
}
